/*
 *Copyright (c) 1997, 2011, Company Name. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 */
package com.vlearn.main;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.vlaearn.spring.aspectj.bean.CustomerBean;

/**
 * @author IB1378
 * @since 21/02/2014
 * 
 *  Main class which is used to analyse the aspectj with spring.
 *  
 */
public class MainClass {

	public static void main(String[] args) {
		
		ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Customer.xml");
		CustomerBean bean = (CustomerBean) context.getBean("customerBean");
		
		/* Before and After log gets executed */
		bean.addCustomer(); //step1
		
		/* Log After Returning will be executed and prints the return value*/
		bean.addCustomerReturnValue(); //step2
		
		/* log Around will be executed before and after method is called */
		bean.addCustomerAround("Shashidhar"); //step3
		
		/* log after throwing runs after an exception is thrown*/
		bean.addCustomerThrowException(); //step4
		
		//comment all and enable any one line above and verify each.
		//http://www.mkyong.com/spring3/spring-aop-aspectj-annotation-example/
	}
}
